package Inherit;

public  class Person {
    private String name;
    private int age;
    public Person(){}

    public Person(String name , int age ){
        this.name =name;
        this.age =age;

    }
    public void setAge(int age){
        this.age=age;
    }

    public int getAge(){
        return age;
    }

    public void setName(String name){
        this.name =name;
    }

    public String getName(){
        return name ;
    }



    public void keepPet(Dog2 dog2,String something){
        System.out.println("年龄为"+age+"的"+getName()+"养了一只"+ dog2.getColor()+"颜色的"+ dog2.getAge()+"岁的狗");
        dog2.eat(something);
    }

    public void keepPet(Cat2 cat2,String something){
        System.out.println("年龄为"+age+"的"+getName()+"养了一只"+ cat2.getColor()+"颜色的"+ cat2.getAge()+"岁的狗");
         cat2.eat(something);
    }
}
